package handlers;


import java.net.Socket;

import common.classes.HeaderWorker;
import common.classes.HeaderWorkerException;


public class SocketReaderHandler extends Handler {
	
	public SocketReaderHandler() {
		super();
	}
	
	public SocketReaderHandler(Handler next) {
		super(next);
	}
	
	@Override
	public void parseRequest(Socket socket, HeaderWorker header, String error) {
		try {
			header = new HeaderWorker(socket);
			if (header.getFilePath().endsWith(".ico"))
				this.closeSocket(socket);
			else super.parseRequest(socket, header, error);
		} catch (HeaderWorkerException e) {
			System.err.println(e);
		}
	}
}
